home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byte0787.arc / NEWGEN.ARC / SAVAGE.C < prev    next >
Encoding:
Text File  |  1987-01-27  |  512 b   |  23 lines

  1. /*
  2. ** savage.c -- floating point speed and accuracy test.  C version
  3. ** derived from BASIC version which appeared in Dr. Dobb's Journal,
  4. ** Sep. 1983, pp. 120-122.
  5. */
  6.  
  7. #define    ILOOP    2500
  8.  
  9. extern    double    tan(), atan(), exp(), log(), sqrt();
  10.  
  11. main()
  12. {
  13. int i;
  14. double a;
  15.  
  16.     printf("start\n");
  17.     a = 1.0;
  18.     for (i = 1; i <= (ILOOP - 1); i++)
  19.         a = tan(atan(exp(log(sqrt(a*a))))) + 1.0;
  20.     printf("a = %20.14e\n", a);
  21.     printf("done\n");
  22. }